{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This sets up a jupyter environment for you to explore the python examples in the underactuated source repository.\n",
    "Simply add a new cell below, copy and paste the contents of a .py file from the notes, and run!  \n",
    "\n",
    "Note: Some examples expect to be able to reference files in the same directory. You can change the working directory in a cell:\n",
    "- Use `%pwd` to check your current directory\n",
    "- Use e.g. `%cd $underactuated_src_dir/quadrotor2d` to change to the quadrotor2d example directory.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Install drake and the underactuated source repo (only if necessary) and set up the path.  Run this first!\n",
    "try:\n",
    "  import pydrake\n",
    "  import underactuated\n",
    "except ImportError:\n",
    "  !curl -s https://raw.githubusercontent.com/RussTedrake/underactuated/master/scripts/setup/jupyter_setup.py > jupyter_setup.py\n",
    "  from jupyter_setup import setup_underactuated\n",
    "  setup_underactuated()\n",
    "# Note: On Google's Colaboratory, this will take a minute, but should only need to reinstall once every 12 hours.\n",
    "# Colab will ask you to \"Reset all runtimes\"; say no to save yourself the reinstall.\n",
    "\n",
    "import os\n",
    "import underactuated\n", 
    "underactuated_src_dir = os.path.dirname(os.path.dirname(os.path.abspath(underactuated.__file__)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
